#include "Pigment.h"

Symbol Pigment::parse(ifstream &file, Symbol curToken) {
    float *numFill;

    curToken = matchToken(file, curToken, LBrace);
    curToken = matchToken(file, curToken, Color);

    if (curToken.t == RGB) {
        curToken = matchToken(file, curToken, RGB);

        numFill = parseVector(file, curToken, &curToken, 3);
        color.x = numFill[0];
        color.y = numFill[1];
        color.z = numFill[2];
        f = 0.0;
        delete numFill;
    }
    else {
        curToken = matchToken(file, curToken, RGBF);
        numFill = parseVector(file, curToken, &curToken, 4);
        color.x = numFill[0];
        color.y = numFill[1];
        color.z = numFill[2];
        f = numFill[3];
        delete numFill;
    }

    return matchToken(file, curToken, RBrace);
}

